import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '@/views/Home/Index.vue'
import Task from '@/views/Task/Index.vue'
import TaskList from '@/views/Task/List/Index.vue'
import TaskDetail from '@/views/Task/Detail/Index.vue'
import LibraryModel from '@/views/Library/Index.vue'
import Library from '@/views/Library/Book/Index.vue'
import LibraryCreate from '@/views/Library/Book/Create.vue'
import LibraryType from '@/views/Library/Type/Index.vue'
import LibraryTypeCreate from '@/views/Library/Type/Create.vue'
import Personage from '@/views/Personage/Index.vue'
import PersonagePerfect from '@/views/Personage/UserInfo.vue'
import Shopping from '@/views/Shopping/Index.vue'
import ShoppingCreate from '@/views/Shopping/Create.vue'
import ReviewList from '@/views/Review/Index.vue'
import ReviewCreates from '@/views/Review/Create.vue'


const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/home',
            name: 'home',
            title: '首页',
            component: Home,
            meta: {
                index: 1,
            }
        },
        {
            path: '/task/list',
            name: 'taskList',
            title: '',
            component: TaskList,
            meta: {
                index: 1
            }
        },
        {
            path: '/task/detail',
            name: 'taskDetail',
            title: '',
            component: TaskDetail,
            meta: {
                index: 2
            }
        },
        {
            path: '/task',
            name: 'task',
            title: '',
            component: Task,
        },
        {
            path: '/library/model',
            name: 'libraryModel',
            title: '图书馆',
            component: LibraryModel,
            meta: {
                index: 1
            }
        }, {
            path: '/library',
            name: 'library',
            title: '图书馆',
            component: Library,
            meta: {
                index: 1
            }
        }, {
            path: '/library/create',
            name: 'libraryCreate',
            title: '图书新增',
            component: LibraryCreate,
            meta: {
                index: 1
            }
        }, {
            path: '/library/edit',
            name: 'libraryEdit',
            title: '图书编辑',
            component: LibraryCreate,
            meta: {
                index: 1
            }
        }, {
            path: '/library/type',
            name: 'libraryType',
            title: '图书类别',
            component: LibraryType,
            meta: {
                index: 1
            }
        }, {
            path: '/library/type/create',
            name: 'libraryTypeCreate',
            title: '图书类别新增',
            component: LibraryTypeCreate,
            meta: {
                index: 1
            }
        }, {
            path: '/library/type/edit',
            name: 'libraryTypeEdit',
            title: '图书类别编辑',
            component: LibraryTypeCreate,
            meta: {
                index: 1
            }
        },
        {
            path: '/personage',
            name: 'personage',
            title: '我的',
            component: Personage,
            meta: {
                index: 1
            }
        },
        {
            path: '/personage/perfect',
            name: 'personagePerfect',
            title: '完善信息',
            component: PersonagePerfect,
            meta: {
                index: 1
            }
        },
        {
            path: '/shopping',
            name: 'shopping',
            title: '商城',
            component: Shopping,
            meta: {
                index: 1
            }
        }, {
            path: '/shopping/create',
            name: 'shoppingCreate',
            title: '消费',
            component: ShoppingCreate,
            meta: {
                index: 1
            }
        }, {
            path: '/review',
            name: 'reviewList',
            title: '复习',
            component: ReviewList,
            meta: {
                index: 1
            }
        }, {
            path: '/review/create',
            name: 'reviewCreate',
            title: '新增复习',
            component: ReviewCreates,
            meta: {
                index: 1
            }
        },
        {
            path: '/login',
            name: 'login',
            title: '登录',
            component: () => import('@/views/Login/Index.vue'),
            meta: {
                index: 1
            }
        }
    ]
})

export default router
